Modular Arithmetic

Modular arithmetic is concerned with the arithmetic of remainders from division.

Modulo Reduction

Dividing by can be written as , where is the quotient and is the remainder. The modulo operation (%) returns the remainder when dividing by . Programmatically, this is written as a % N and the mathematical equivalent is .

Mapping an integer to its remainder upon division by some number is known as reduction modulo and boils down to mapping the integer to an integer between and .

Modulo Congruence

Two numbers are said to be congruent modulo , written as (terrific notation, mathematicians) if they have the same remainder when dividing by , i.e. . The good thing about modulo congruence is that it under addition, subtraction and multiplication:

Modulo Inversion

If there is an integer such that , then is said to be invertible modulo and is said to be a (multiplicative) inverse of modulo . A given integer may have many multiplicative inverses - for example, it is fairly easy to show that if is a multiplicative inverse of , then so is and if is yet another inverse of , then . For simplicity, the multiplicative inverse of which is in the range is denoted by .

Modulo division by can then be defined as multiplication by and this gives the following nice property:

Groups

A group is simply a set equipped with a group operation which satisfy the following properties:

  • Closure: For all ,
  • Identity: There exists an identity element such that for all
  • Invertibility: For each there exists an inverse element such that
  • Associativity: For all

A group whose operation also supports commutativity (i.e., ) is called abelian.

The order of a group, denoted by , is the number of elements in the group.

Additive vs Multiplicative Notation

The group operation is often denoted in a different way.

Additive notation uses the sign for its group operation, i.e. . However, this does not mean that the group's operation is necessarily addition. The identity element here is denoted by and the inverse of an element is written as . Applying the group operation to a single element a total of times is denoted as

Note that is an integer while is an element of the group and so is not the group operation applied between and .

Multiplicative notation denotes the group operation either by or by . Once again, this does not mean that the group operation is necessarily multiplication - it is simply written this way. The identity element here is denoted by and the inverse of an element is written as . Applying the group operation to a single element a total of times is denoted via exponentiation:

Once again, is an integer and not a member of the group. This is useful notation because it truly "behaves" like exponentiation in regards to its properties: and . Furthermore, if the group is abelian, then for all it holds that .

Some Facts about Groups

Lemma: Cancelation Law for Group Operations

For all , if , then and in particular, if , then is the identity element of .

Proof

TODO

Interestingly, if the group is finite and , applying the group operation a single element number of times, then we get the identity element.

Theorem

For any finite group and element , it holds that g^{|\mathbb{G}|} = 1.

Proof

TODO

As a corollary of this, it turns out that applying the group operation to the same element more than |\mathbb{G}|\mod |\mathbb{G}| times which brings computational benefits.

Theorem

For any finite group \mathbb{G}|\mathbb{G}| \gt 1g \in \mathbb{G}g^x = g^{[x \mod |\mathbb{G}|]}

Proof

The Groups \mathbb{Z}_N\mathbb{Z}_N^\mathbb{Z}_N{0,1, ..., N - 1}N{0,...,N_1}0a + (N - a) = 0 \mod NN - aN{0,1,..., N -1}{0,1,..., N -1}NN\mathbb{Z}_N^N\mathbb{Z}_N^*.

Cyclic Groups

For any g \in \mathbb{G}\mathbb{G}g^{|\mathbb{G}|} = 1i\le |\mathbb{G}|g^i = 1{g^0, g^1, g^2, ...}ig^i = g^0, g^{i+1} = g^1\langle g \rangle\mathbb{G}igig.

There are some interesting properties of such elements.

Lemma

For any element gi\mathbb{G}g^x = g^yx = y \mod i.

Proof

TODO

Lemma

The order ig\mathbb{G}i | mm\mathbb{G}.

Proof

TODO

Cyclic Groups

A group \mathbb{G}\mathbb{G}g \in \mathbb{G}|\mathbb{G}|\mathbb{G}h \in \mathbb{G}g^xx \in {0,1,..., |\mathbb{G}| -1}\langle g \rangle|\mathbb{G}||\mathbb{G}|\langle g \rangle\mathbb{G}, then they must contain the exact same elements.

Cyclic groups have some interesting properties.

Theorem: Prime Order

Any group \mathbb{G}p is cyclic and all of its elements, except for the identity, are its generators.

Proof

The group order pii = pi = 11p\mathbb{Z}_p^*pp-1$.